Installation and Software Organization¶
Installation¶
therapy_planner can be easily installed with pip and is suitable for an environment running Python 3. We suggest working with a virtual environment when using our package.
- Ensure that
virtualenvforpython3has been installed. - Create a new virtual environment:
virtualenv env --python=python3 - Activate the environment:
source env/bin/activate. - Install
therapy_planner:pip install therapy_planner.
Testing¶
pytest may be used to run the test suite that comes with therapy_planner.
- Within the virtual environment, install
pytest:pip install pytest. note: A terminal restart is likely necessary after installingpytestfor changes to take effect. - Run the
therapy_plannertest suite:pytest --pyargs therapy_planner.
Software Organization¶
therapy_planner is maintained on GitHub, with Travis CI and Coveralls for continuous integration.
Directory Structure¶
therapy_planner\
therapy_planner\
tests\
__init__.py
test_interface.py
test_costfunctions.py
test_bfgs.py
__init__.py
interface.py
costfunctions.py
bfgs.py
timer.py
setup.py
requirements.txt
LICENSE
README.md
MANIFEST.in
docs\
examples\
bfgs_demo.ipynb
optimize_demo.ipynb
README.md
.travis.yml
setup.cfg
Modules¶
- therapy_planner/interface.py: This is the main module users will import, which defines a user-friendly
PlannerInterfaceClass to read in input data, run optimization, and visualize the results. - therapy_planner/costfunctions.py: Defines different contributions to the cost function used in optimization, including mean squared error and a logistic penalty function.
- therapy_planner/bfgs.py: Includes the BFGS routine implemented with
gradpy, which is used bytherapy_plannerto perform a minimization of the cost function. - therapy_planner/timer.py: A timer function decorator used to measure and report optimization time.
- gradpy/tests/: A directory of test modules used in validating our implementation.
Examples¶
- docs/examples/bfgs_demo.ipynb: An example of objective function minimization with
gradpyusing the BFGS algorithm. - docs/examples/optimize_demo.ipynb: Several demos of use cases for
therapy_planner, including handling missing data, adding and tuning penalties to the cost function, and making use of different built-in visualizations of the results.